unit CheckDocFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  dxSkinsCore, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinscxPCPainter, dxLayoutControl, cxContainer, cxListBox, Menus, StdCtrls,
  cxButtons, dxLayoutContainer, dxLayoutControlAdapters, cxEdit;

type
  TCheckDocForm = class(TForm)
    dxLayoutControl1Group_Root: TdxLayoutGroup;
    dxLayoutControl1: TdxLayoutControl;
    ListBox: TcxListBox;
    dxLayoutControl1Item1: TdxLayoutItem;
    dxLayoutControl1Group1: TdxLayoutGroup;
    cxButton1: TcxButton;
    dxLayoutControl1Item2: TdxLayoutItem;
    cxButton2: TcxButton;
    dxLayoutControl1Item3: TdxLayoutItem;
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  private
    { Private declarations }
  public
    procedure Clear;
    procedure AddItem(S: string);
    function GetIndex: integer;
  end;

var
  CheckDocForm: TCheckDocForm;

implementation

uses MainFrm;

{$R *.dfm}

procedure TCheckDocForm.AddItem(S: string);
begin
  ListBox.Items.Add(S);
  ListBox.ItemIndex:=0;
end;

procedure TCheckDocForm.Clear;
begin
  ListBox.Items.Clear;
end;

procedure TCheckDocForm.cxButton1Click(Sender: TObject);
begin
  ModalResult:=mrOk;
end;

procedure TCheckDocForm.cxButton2Click(Sender: TObject);
begin
  ModalResult:=mrCancel;
end;

procedure TCheckDocForm.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    VK_RETURN: ModalResult:=mrOk;
    VK_CANCEL: ModalResult:=mrCancel;
  end;
end;

function TCheckDocForm.GetIndex: integer;
begin
  Result:=ListBox.ItemIndex;
end;

end.
